home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gtk-2.0 / gtk / gtkrc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  7.3 KB  |  245 lines

  1. /* GTK - The GIMP Toolkit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GTK_RC_H__
  28. #define __GTK_RC_H__
  29.  
  30.  
  31. #include <gtk/gtkstyle.h>
  32.  
  33. G_BEGIN_DECLS
  34.  
  35. /* Forward declarations */
  36. typedef struct _GtkIconFactory  GtkIconFactory;
  37. typedef struct _GtkRcContext    GtkRcContext;
  38.  
  39. typedef struct _GtkRcStyleClass GtkRcStyleClass;
  40.  
  41. #define GTK_TYPE_RC_STYLE              (gtk_rc_style_get_type ())
  42. #define GTK_RC_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
  43. #define GTK_RC_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
  44. #define GTK_IS_RC_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
  45. #define GTK_IS_RC_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
  46. #define GTK_RC_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
  47.  
  48. typedef enum
  49. {
  50.   GTK_RC_FG        = 1 << 0,
  51.   GTK_RC_BG        = 1 << 1,
  52.   GTK_RC_TEXT        = 1 << 2,
  53.   GTK_RC_BASE        = 1 << 3
  54. } GtkRcFlags;
  55.  
  56. struct _GtkRcStyle
  57. {
  58.   GObject parent_instance;
  59.  
  60.   /*< public >*/
  61.   
  62.   gchar *name;
  63.   gchar *bg_pixmap_name[5];
  64.   PangoFontDescription *font_desc;
  65.  
  66.   GtkRcFlags color_flags[5];
  67.   GdkColor   fg[5];
  68.   GdkColor   bg[5];
  69.   GdkColor   text[5];
  70.   GdkColor   base[5];
  71.  
  72.   gint xthickness;
  73.   gint ythickness;
  74.  
  75.   /*< private >*/
  76.   GArray *rc_properties;
  77.   
  78.   /* list of RC style lists including this RC style */
  79.   GSList *rc_style_lists;
  80.  
  81.   GSList *icon_factories;
  82.  
  83.   guint engine_specified : 1;    /* The RC file specified the engine */
  84. };
  85.  
  86. struct _GtkRcStyleClass
  87. {
  88.   GObjectClass parent_class;
  89.  
  90.   /* Create an empty RC style of the same type as this RC style.
  91.    * The default implementation, which does
  92.    * g_object_new (G_OBJECT_TYPE (style), NULL);
  93.    * should work in most cases.
  94.    */
  95.   GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
  96.  
  97.   /* Fill in engine specific parts of GtkRcStyle by parsing contents
  98.    * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
  99.    * the token it expected but didn't get.
  100.    */
  101.   guint     (*parse)  (GtkRcStyle   *rc_style,
  102.                GtkSettings  *settings,
  103.                GScanner     *scanner);
  104.   
  105.   /* Combine RC style data from src into dest. If overriden, this
  106.    * function should chain to the parent.
  107.    */
  108.   void      (*merge)  (GtkRcStyle *dest,
  109.                GtkRcStyle *src);
  110.  
  111.   /* Create an empty style suitable to this RC style
  112.    */
  113.   GtkStyle * (*create_style) (GtkRcStyle *rc_style);
  114.  
  115.   /* Padding for future expansion */
  116.   void (*_gtk_reserved1) (void);
  117.   void (*_gtk_reserved2) (void);
  118.   void (*_gtk_reserved3) (void);
  119.   void (*_gtk_reserved4) (void);
  120. };
  121.  
  122. #ifdef G_OS_WIN32
  123. /* Reserve old names for DLL ABI backward compatibility */
  124. #define gtk_rc_add_default_file gtk_rc_add_default_file_utf8
  125. #define gtk_rc_set_default_files gtk_rc_set_default_files_utf8
  126. #define gtk_rc_parse gtk_rc_parse_utf8
  127. #endif
  128.  
  129. void      _gtk_rc_init            (void);
  130. void      gtk_rc_add_default_file    (const gchar *filename);
  131. void      gtk_rc_set_default_files      (gchar **filenames);
  132. gchar**   gtk_rc_get_default_files      (void);
  133. GtkStyle* gtk_rc_get_style        (GtkWidget   *widget);
  134. GtkStyle* gtk_rc_get_style_by_paths     (GtkSettings *settings,
  135.                      const char  *widget_path,
  136.                      const char  *class_path,
  137.                      GType        type);
  138.  
  139. gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
  140.                       gboolean     force_load);
  141. void     gtk_rc_reset_styles             (GtkSettings *settings);
  142.  
  143. gchar*   gtk_rc_find_pixmap_in_path (GtkSettings  *settings,
  144.                      GScanner     *scanner,
  145.                      const gchar  *pixmap_file);
  146.  
  147. void      gtk_rc_parse            (const gchar *filename);
  148. void      gtk_rc_parse_string        (const gchar *rc_string);
  149. gboolean  gtk_rc_reparse_all        (void);
  150.  
  151. #ifndef GTK_DISABLE_DEPRECATED
  152. void      gtk_rc_add_widget_name_style    (GtkRcStyle   *rc_style,
  153.                      const gchar  *pattern);
  154. void      gtk_rc_add_widget_class_style (GtkRcStyle   *rc_style,
  155.                      const gchar  *pattern);
  156. void      gtk_rc_add_class_style    (GtkRcStyle   *rc_style,
  157.                      const gchar  *pattern);
  158. #endif /* GTK_DISABLE_DEPRECATED */
  159.  
  160.  
  161. GType       gtk_rc_style_get_type   (void) G_GNUC_CONST;
  162. GtkRcStyle* gtk_rc_style_new        (void);
  163. GtkRcStyle* gtk_rc_style_copy       (GtkRcStyle *orig);
  164. void        gtk_rc_style_ref        (GtkRcStyle *rc_style);
  165. void        gtk_rc_style_unref      (GtkRcStyle *rc_style);
  166.  
  167. gchar*        gtk_rc_find_module_in_path    (const gchar     *module_file);
  168. gchar*        gtk_rc_get_theme_dir        (void);
  169. gchar*        gtk_rc_get_module_dir        (void);
  170. gchar*        gtk_rc_get_im_module_path    (void);
  171. gchar*        gtk_rc_get_im_module_file    (void);
  172.  
  173. /* private functions/definitions */
  174. typedef enum {
  175.   GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
  176.   GTK_RC_TOKEN_INCLUDE,
  177.   GTK_RC_TOKEN_NORMAL,
  178.   GTK_RC_TOKEN_ACTIVE,
  179.   GTK_RC_TOKEN_PRELIGHT,
  180.   GTK_RC_TOKEN_SELECTED,
  181.   GTK_RC_TOKEN_INSENSITIVE,
  182.   GTK_RC_TOKEN_FG,
  183.   GTK_RC_TOKEN_BG,
  184.   GTK_RC_TOKEN_TEXT,
  185.   GTK_RC_TOKEN_BASE,
  186.   GTK_RC_TOKEN_XTHICKNESS,
  187.   GTK_RC_TOKEN_YTHICKNESS,
  188.   GTK_RC_TOKEN_FONT,
  189.   GTK_RC_TOKEN_FONTSET,
  190.   GTK_RC_TOKEN_FONT_NAME,
  191.   GTK_RC_TOKEN_BG_PIXMAP,
  192.   GTK_RC_TOKEN_PIXMAP_PATH,
  193.   GTK_RC_TOKEN_STYLE,
  194.   GTK_RC_TOKEN_BINDING,
  195.   GTK_RC_TOKEN_BIND,
  196.   GTK_RC_TOKEN_WIDGET,
  197.   GTK_RC_TOKEN_WIDGET_CLASS,
  198.   GTK_RC_TOKEN_CLASS,
  199.   GTK_RC_TOKEN_LOWEST,
  200.   GTK_RC_TOKEN_GTK,
  201.   GTK_RC_TOKEN_APPLICATION,
  202.   GTK_RC_TOKEN_THEME,
  203.   GTK_RC_TOKEN_RC,
  204.   GTK_RC_TOKEN_HIGHEST,
  205.   GTK_RC_TOKEN_ENGINE,
  206.   GTK_RC_TOKEN_MODULE_PATH,
  207.   GTK_RC_TOKEN_IM_MODULE_PATH,
  208.   GTK_RC_TOKEN_IM_MODULE_FILE,
  209.   GTK_RC_TOKEN_STOCK,
  210.   GTK_RC_TOKEN_LTR,
  211.   GTK_RC_TOKEN_RTL,
  212.   GTK_RC_TOKEN_LAST
  213. } GtkRcTokenType;
  214.  
  215. GScanner* gtk_rc_scanner_new    (void);
  216. guint      gtk_rc_parse_color    (GScanner         *scanner,
  217.                  GdkColor         *color);
  218. guint      gtk_rc_parse_state    (GScanner         *scanner,
  219.                  GtkStateType         *state);
  220. guint      gtk_rc_parse_priority    (GScanner         *scanner,
  221.                  GtkPathPriorityType *priority);
  222.  
  223. /* rc properties
  224.  * (structure forward declared in gtkstyle.h)
  225.  */
  226. struct _GtkRcProperty
  227. {
  228.   /* quark-ified property identifier like "GtkScrollbar::spacing" */
  229.   GQuark type_name;
  230.   GQuark property_name;
  231.  
  232.   /* fields similar to GtkSettingsValue */
  233.   gchar *origin;
  234.   GValue value;
  235. };
  236. const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style,
  237.                                GQuark      type_name,
  238.                                GQuark      property_name);
  239.  
  240. const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings);
  241.  
  242. G_END_DECLS
  243.  
  244. #endif /* __GTK_RC_H__ */
  245.